import Phaser from 'phaser';

export default class BootGame extends Phaser.Scene{

    constructor(){
        super('bootGame');
    }

    preload(){
        const prefix = assets_cdn||'assets/img/';
        this.load.image('space_bg', prefix+'space_bg.jpg');
        this.load.spritesheet('bullet', prefix+'bullet.png', {
            frameHeight:90,
            frameWidth:90
        });
        this.load.spritesheet('ship', prefix+'ship.png', {
            frameHeight:251,
            frameWidth:164
        });
        this.load.spritesheet('boom', prefix+'boom.png', {
            frameHeight:96,
            frameWidth:96
        });
    }

    create(){
        this.add.text(20, 20, "loading...")
        this.anims.create({
            key:'boom',
            frames:this.anims.generateFrameNumbers('boom', {
                start:0,
                end:4
            }),
            frameRate:10,
            repeat:0,
            hideOnComplete:true
            
        });
        this.anims.create({
            key:'shoot',
            frames:this.anims.generateFrameNumbers('bullet', {
                start:0,
                end:3
            }),
            frameRate:10,
            repeat:-1
            
        });
        this.scene.start('playGame');
    }

}